///------------------------
///说明：单表基本List页方法
///-----------------------
import { getPageSize } from '/@/utils';
import { getStartTime, getEndTime } from '/@/utils/formatTime';
/**
 * 检索页基类
 * @param GetDatePage 检索方法
 * @param TargetFields 关键词字段
 * @param dataKuaDu 检索日期跨度（默认0检索当天）
 * @returns
 */
export default function ListMastControls(GetDatePage: Function, TargetFields?: string, dataKuaDu: number = 0) {
	const checkParam = reactive({
		keyword: undefined,
		targetFields: TargetFields,
		startCreationTime: getStartTime(dataKuaDu),
		endCreationTime: getEndTime(),
		page: 1,
		pageSize: getPageSize(),
	});
	let list = ref([]);
	const total = ref(0);
	const search = () => {
		GetDatePage(checkParam).then((re: any) => {
			list.value = re?.items;
			total.value = re.total;
		});
	};

	return {
		checkParam,
		total,
		list,
		search,
	};
}
